package org.xs.big_event.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xs.big_event.dao.aeticle.Article;
import org.xs.big_event.dao.pageRequest;
import org.xs.big_event.service.impl.ArticleService;
import org.xs.big_event.utils.R;

@RestController
@RequestMapping("/api/article")
public class ArticleController {
    private ArticleService articleService;
    @Autowired
    ArticleController(ArticleService articleService) {
        this.articleService = articleService;
    }
    @PostMapping("/add")
    public R add(@RequestBody Article article) {
        return articleService.add(article);
    }
    @PostMapping("/list")
    public R list(@RequestBody pageRequest pagerequest){
        return articleService.list(pagerequest);
    }
}
